home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format CD 49
/
Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso
/
-serious-
/
graphics
/
amicad
/
arexx_english
/
duplicate.amicad
< prev
next >
Wrap
Text File
|
1999-12-06
|
3KB
|
160 lines
/* Clonage d'un composant, en "augmentant sa référence"
$VER: 1.01e (© R.Florac, 22 mai 1999) */
options results /* indispensable pour récupérer le résultat des macros */
signal on error /* pour l'interception des erreurs */
signal on syntax
'FIRSTSEL'
o=result
if o=0 then do
'MESSAGE("Select the"+CHR(10)+"component to copy !")'
exit
end
type=0
do while type=0
'TYPE('o')'
select
when result=1 then do
type=1
leave
end
when result=4 then do
type=4
leave
end
when result=11 then do
type=11
leave
end
when result=12 then do
type=12
leave
end
otherwise nop
end
'NEXTSEL('o')'; o=result
if o=0 then do
'MESSAGE("Incorrect selection")'
exit
end
end
if type=1 then 'READTEXT(GETREF('o'))'
else 'READTEXT('o')'
ref=result
j=numero_reference(ref)
ref=reference(ref)
'WIDTH(0)'; l=(result%10)*10
'HEIGHT(0)'; h=(result%10)*10
'COL(0)'; x0=result
'LINE(0)'; y0=result
'SELECT("Copy direction"+CHR(10)+"Bottom"+CHR(10)+"Right"+CHR(10)+"Up"+CHR(10)+"Left")'
sens=result
if sens < 1 then exit
'ASKNUM("How many times"+CHR(10)+"do you want to do"+CHR(10)+"the operation?",2)'
n=result
if n<1 then exit
'SELECT("Step beetween copies"+CHR(10)+"10 pixels"+CHR(10)+"20 pixels"+CHR(10)+"30 pixels"+CHR(10)+"Automatic"+CHR(10)+"Specified")'
pas = result
select
when pas=1 then pas=0
when pas=2 then pas=10
when pas=3 then pas=20
when pas=4 then do
if sens=1 | sens=3 then pas=h
else pas=l
end
when pas=5 then do
'ASKNUM("Step beetween copies",10)'
pas=result
end
otherwise exit
end
'COPY(5)' /* sauvegarde des éléments à copier */
'SAVEALL(-1)'
do i=1 to n
select
when sens=1 then do /* Copie vers le bas */
yy=y0+(10+pas)*i
yy=(yy%10)*10
'PASTE(5,'x0','yy')'
end
when sens=2 then do
xx=x0+(10+pas)*i
xx=(xx%10)*10
'PASTE(5,'xx','y0')'
end
when sens=3 then do
yy=y0-(10+pas)*i
yy=(yy%10)*10
'PASTE(5,'x0','yy')'
end
otherwise do
'MESSAGE("Not allready implemented!")'
end
end
if ref ~= "" then do
j=j+1
k=indice(type)
if type=1 then 'SETREF('k',"'ref||j'"):UNMARK(-1)'
else 'SETTEXT('k',"'ref||j'"):UNMARK(-1)'
end
end
exit
indice: procedure
parse arg type
'FIRSTSEL'
o=result
do while o>0
'TYPE('o')'
select
when result=type then return o
otherwise nop
end
'NEXTSEL('o')'; o=result
end
return 0
reference: procedure
parse arg ref
i=length(ref)
do while i>1
c=substr(ref,i,1)
if datatype(c)=NUM then ref=left(ref,i-1)
else return ref
i=i-1
end
return ref
numero_reference: procedure
parse arg ref
i=length(ref)
r=0
rang=1
do while i>1
c=substr(ref,i,1)
if datatype(c)=NUM then do
r=r+c*rang
rang=rang*10
end
else return r
i=i-1
end
return r
/* Traitement des erreurs, interruption du programme */
syntax:
erreur=RC
'MESSAGE("Script Duplicate.AmiCAD"+CHR(10)+"Syntax error"+CHR(10)+"en ligne 'SIGL'"+CHR(10)+"'errortext(erreur)'")'
exit
error:
'MESSAGE("Script Duplicate.AmiCAD"+CHR(10)+"Error in line 'SIGL'")'
exit